//
//  YRJDiscountZoneCollectionViewCell.m
//  YanRenjie
//
//  Created by dllo on 15/10/27.
//  Copyright (c) 2015年 yanrenjie. All rights reserved.
//

#import "YRJDiscountZoneCollectionViewCell.h"
#define SWIDTH ([UIScreen mainScreen].bounds.size.width)
#define SHEIGH ([UIScreen mainScreen].bounds.size.height)
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation YRJDiscountZoneCollectionViewCell
- (void)dealloc {
    [_photoImageView release];
    [_priceLabel release];
    [_priceoffLabel release];
    [_titleLabel release];
    
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell {
    self.photoImageView = [[UIImageView alloc] init];
    [self addSubview:self.photoImageView];
    [_photoImageView release];
    self.photoImageView.userInteractionEnabled = YES;
    
    self.titleLabel = [[UILabel alloc] init];
    [self addSubview:self.titleLabel];
    [_titleLabel release];
    self.titleLabel.font = [UIFont systemFontOfSize:14 * (SHEIGH / 667)];
    self.titleLabel.numberOfLines = 2;
    self.titleLabel.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:0.6];
    
    self.priceLabel = [[UILabel alloc] init];
    [self addSubview:self.priceLabel];
    [_priceLabel release];
    self.priceLabel.font = [UIFont systemFontOfSize:10 * (SHEIGH / 667)];
    self.priceLabel.textColor = [UIColor redColor];
    self.priceLabel.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:0.6];
    
    self.priceoffLabel = [[UILabel alloc] init];
    [self addSubview:self.priceoffLabel];
    [_priceoffLabel release];
    self.priceoffLabel.font = [UIFont systemFontOfSize:10 * (SHEIGH / 667)];
    self.priceoffLabel.textColor = [UIColor redColor];
    self.priceoffLabel.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:0.6];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.photoImageView.frame = CGRectMake((2.50 / 180.0) * WIDTH, (2.5 / 180) * HEIGHT, WIDTH, (120.0 / 180.0) * HEIGHT);
    self.titleLabel.frame = CGRectMake((2.50 / 180.0) * WIDTH, (120.0 / 180.0) * HEIGHT, (180.0 / 180.0) * WIDTH, (40.0 / 180.0) * HEIGHT);
    self.priceoffLabel.frame = CGRectMake((2.50 / 180.0) * WIDTH, (160.0 / 180.0) * HEIGHT, (90.0 / 180.0) * WIDTH, (20.0 / 180.0) * HEIGHT);
    self.priceLabel.frame = CGRectMake((92.50 / 180.0) * WIDTH, (160.0 / 180.0) * HEIGHT, (90.0 / 180.0) * WIDTH, (20.0 / 180.0) * HEIGHT);
    NSLog(@"%f", WIDTH);
    NSLog(@"%f", HEIGHT);
}
@end
